﻿
namespace TinyMceWrapper.Web.Configuration
{

    #region [ Imports ]

    using System.Configuration;
    using System.Diagnostics.CodeAnalysis;

    #endregion

    public sealed class TinyMceDisplayMode : ConfigurationElement
    {

        #region [ Local Fields ]

        private static readonly ConfigurationProperty _name = new ConfigurationProperty("name", typeof(string), null, null, new StringValidator(1), ConfigurationPropertyOptions.IsKey | ConfigurationPropertyOptions.IsRequired);
        private static readonly ConfigurationProperty _options = new ConfigurationProperty("options", typeof(TinyMceOptionCollection));
        private static readonly ConfigurationPropertyCollection _properties = new ConfigurationPropertyCollection();

        #endregion

        #region [ Constructors ]

        [SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline")]
        static TinyMceDisplayMode()
        {
            _properties.Add(_name);
            _properties.Add(_options);
        }

        #endregion

        #region  [ Public Properties ]

        [ConfigurationProperty("name", IsKey = true, IsRequired = true), StringValidator(MinLength = 1)]
        public string Name
        {
            get { return (string)this[_name]; }
            set { this[_name] = value; }
        }

        [ConfigurationProperty("options")]
        public TinyMceOptionCollection Options
        {
            get { return (TinyMceOptionCollection)this[_options]; }
        }

        #endregion

        #region [ Overriden Members ]

        protected override ConfigurationPropertyCollection Properties
        {
            get { return _properties; }
        }

        #endregion

    }

}
